package com.yuhs.zixing.study.design.pattern.dp002.structural.s007.proxy.p006;

import java.lang.reflect.InvocationHandler;

/**
 * @description:
 * @author: yuhs
 * @date: 2022/5/2 9:26 PM
 */
public class SubjectDynamicProxy006 extends DynamicProxy006 {
    public static <T> T newProxyInstance(Subject006 subject) {
        //获得ClassLoader
        ClassLoader loader = subject.getClass().getClassLoader();
        //获得接口数组
        Class<?>[] classes = subject.getClass().getInterfaces();
        //获得handler
        InvocationHandler handler = new MyInvocationHandler006(subject);
        return newProxyInstance(loader, classes, handler);
    }
}
